package com.lianbang.pharmacy.adapter

import android.graphics.Paint
import android.widget.TextView
import cn.ubest.mvvmcore.base.BaseActivity
import cn.ubest.mvvmcore.utils.ResourcesUtils
import cn.ubest.mvvmcore.utils.SpanUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.lianbang.pharmacy.R

/**
 * Created by maoqi on 2020/12/15.
 */
class CouponCenterListAdapter :
    BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_coupon_center_list), LoadMoreModule {
    override fun convert(helper: BaseViewHolder, item: String) {
        helper.setBackgroundColor(R.id.iv_img, ResourcesUtils.getColor(R.color.black))
            .setText(R.id.tv_title, "安神补脑液")
            .setText(R.id.tv_progress, "36%")
            .setText(R.id.tv_old_price, "¥236.00")
            .setText(
                R.id.tv_new_price, SpanUtils()
                    .append("领劵后¥")
                    .setFontSize(8, true).append("136.00").setBold().create()
            )
            .setText(
                R.id.tv_coupon_price,
                SpanUtils().append("¥").append("200").setFontSize(28, true).create()
            )
            .setText(R.id.tv_coupon_category, "无门槛券")
        val tvOldPrice = helper.getView<TextView>(R.id.tv_old_price)
        tvOldPrice.paintFlags = tvOldPrice.paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
    }

}